<%@   page   language="java"   import="java.util.*,com.ejoysoft.wlanyz.business.Flowanalysis"   pageEncoding="UTF-8"%> 
<%@ include file="../include/jsp/head.jsp"%>

<%
    String  strStartTime = ParamUtil.getString(request,"strStartTime","");
    String  strEndTime = ParamUtil.getString(request,"strEndTime","");
        String twhere = " where 1 = 1 ";
    //System.out.println("wwwwwwwwww----------------"+strStartTime+strEndTime);
    if(!strStartTime.equals("")&&!strEndTime.equals("")){
	 if(strStartTime.compareTo(strEndTime)>0)
       {
          out.print("<script>alert('起始时间大于终止时间，请重新输入');window.history.back(-1);</script>");  	
        } 
	}
    Flowanalysis obj = new Flowanalysis(globa);
    Vector<Flowanalysis> objAddr = obj.listMap(twhere,strStartTime,strEndTime);
 %>
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
<script type="text/javascript">

var image1 = new BMap.Icon('../images/map_blue.png', new BMap.Size(40, 50), {//wlan图形
offset: new BMap.Size(10, 25), // 指定定位位置
imageOffset: new BMap.Size(0, 0 ) // 设置图片偏移
});
var image2 = new BMap.Icon('../images/map_red.png', new BMap.Size(40, 50), {//td图形
offset: new BMap.Size(10, 25), // 指定定位位置
imageOffset: new BMap.Size(0, 0 ) // 设置图片偏移
});
var image3 = new BMap.Icon('../images/jxwd.jpg', new BMap.Size(40, 50), {//gsm图形
offset: new BMap.Size(10, 25), // 指定定位位置
imageOffset: new BMap.Size(0, 0 ) // 设置图片偏移
});
var image4 = new BMap.Icon('../images/map_black.png', new BMap.Size(40, 50), {//多个指标时图形
offset: new BMap.Size(10, 25), // 指定定位位置
imageOffset: new BMap.Size(0, 0 ) // 设置图片偏移
});

function show(){
var map = new BMap.Map("allmap");
map.addControl(new BMap.NavigationControl());//鼠标平移缩放控件
map.addControl(new BMap.OverviewMapControl());//右下角可视控件
map.addControl(new BMap.MapTypeControl()); //地图类型控件
map.enableScrollWheelZoom();// 启用滚轮放大缩小
var point = new BMap.Point(117.17, 31.52);//创建坐标点的位置
		map.centerAndZoom(point, 10);
//var markers = [];//wlan

// 创建地址解析器实例
<% 
    for(int i = 0;i < objAddr.size();i++){//wlan's city ,town and corretype
    Flowanalysis obj1 = objAddr.get(i);
    String city = obj1.getStrCity();
    String town = obj1.getStrTown();
    String corre = obj1.getStrCorreType();
    ArrayList<String> types = obj1.getTypeByAddr(city,town,corre,strStartTime,strEndTime);
    String startTime = "";
  
%>
var myGeo = new BMap.Geocoder();
// 将地址解析结果显示在地图上,并调整地图视野
myGeo.getPoint("<%=city+town+corre %>", function(point){//通过地名解析出坐标值
<%
//System.out.println("88888888888888888888"+types.get(0));
if(types.size()==1){//当该地点只有一个网络类型时
startTime = obj1.getTime(city,town,corre,strStartTime,strEndTime,types.get(0));
 if(types.get(0).equals("WLAN")){
%>
var marker = new BMap.Marker(point,{icon:image1});//标记坐标点
<%
 }else if(types.get(0).equals("TD")){
%>
var marker = new BMap.Marker(point,{icon:image2});//标记坐标点
<%}
  else if(types.get(0).equals("GSM")){
%>
var marker = new BMap.Marker(point,{icon:image3});//标记坐标点
<%
}
%>
if (point) {
//map.centerAndZoom(point, 16);
map.addOverlay(marker);
(function(){
marker.addEventListener('click', function(){
this.openInfoWindow(new BMap.InfoWindow('城市：'+'<%=city %>'+'<br/>区县：'+'<%=town %>'
+'<br/>网元名称：'+'<%=corre %>'+'<br/>开始时间：'+'<%=startTime %>'
));
}); 
})();
}
}, "<%=city %>");

<%}else if(types.size()>1){//当该地点有一个以上网络类型时
//System.out.println("9999999");
%>
var marker = new BMap.Marker(point,{icon:image4});//标记坐标点
if (point) {
//map.centerAndZoom(point, 16);
map.addOverlay(marker);
(function(){
marker.addEventListener('click', function(){
this.openInfoWindow(new BMap.InfoWindow('城市：'+'<%=city %>'+'<br/>区县：'+'<%=town %>'
+'<br/>网元名称：'+'<%=corre %>'+'<br/>网络类型：WLAN'+'<br/>开始时间：'
+'<%=obj1.getTime(city,town,corre,strStartTime,strEndTime,"WLAN")==null?"无此种网络类型":obj1.getTime(city,town,corre,strStartTime,strEndTime,"WLAN") %>'
+'<br/>数据流量'+'<%=obj1.getFlowsNum(city,town,corre,strStartTime,strEndTime,"WLAN") %>'
+'<br/>网络类型：TD'+'<br/>开始时间：'+'<%=obj1.getTime(city,town,corre,strStartTime,strEndTime,"TD")==null?"无此种网络类型":obj1.getTime(city,town,corre,strStartTime,strEndTime,"TD") %>'
+'<br/>数据流量'+'<%=obj1.getFlowsNum(city,town,corre,strStartTime,strEndTime,"TD") %>'
+'<br/>网络类型：GSM'+'<br/>开始时间：'+'<%=obj1.getTime(city,town,corre,strStartTime,strEndTime,"GSM")==null?"无此种网络类型":obj1.getTime(city,town,corre,strStartTime,strEndTime,"GSM") %>'
+'<br/>数据流量'+'<%=obj1.getFlowsNum(city,town,corre,strStartTime,strEndTime,"GSM") %>'
));
}); 
})();
}
}, "<%=city %>");
<%
}
%>

<% 
}
%>
}
function showAc(){
 frm.action="map_show.jsp";
  frm.submit();
 }
</script>
<script src="../include/DatePicker/WdatePicker.js"></script>
<title>数据流量地图显示</title>
</head>

<body onload="show(); ">
<form id=frm name=frm action="map_show.jsp" method="post">
<table width="100%" height="100%" align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="8FA6BD" >   
<tr><td width="100%" bgcolor="#E9F1FE">
 <table align="center" width="1000">
    <tr>
		 <td align="right" width="40%" >起止时间(<span class="STYLE1">*</span>)
	          <input id="strStartTime" name="strStartTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strStartTime %>" style="width:100"/>-
	          <input id="strEndTime" name="strEndTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strEndTime %>"style="width:100"/>
	          <img src="../images/search.jpg" width="58" height="28" onclick="showAc()" style="cursor:hand"/>
          </td>
	</tr>
 </table></td></tr>
 <tr height="82%"><td><div id="allmap" style="width: 100%; height: 100%"></div></td> </tr>
    
   <tr height="10%"><td bgcolor="#E9F1FE">
<table align="center" >
   <tr>
	     <td ><img src = "../images/map_blue.png"  ></img>WLAN数据流量</td>
	     <td ><img src = "../images/map_red.png"  ></img>TD数据流量</td>
	     <td ><img src = "../images/jxwd.jpg"  ></img>GSM数据流量</td>
	     <td ><img src = ../images/map_black.png  ></img>多种数据流量</td>
   </tr>
</table></td></tr>
 </table>
 </form>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>

 

